<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="css/bootstrap.css">
    <script src="js/jquery.js"></script>
    <script src="js/bootstrap.js"></script>
    <script src="js/common.js"></script>
    <script type="text/javascript">
        $(function () {
            $("form").submit(function () {
                //AJAX登录
                $.ajax({
                    url:    GC.bctx + "checklogin",
                    type:"POST",
                    data:$("form").serialize(),
                    success:function (r) {
                    if(r.successed){
                        localStorage.setItem("token",r.data)
                        localStorage.setItem("account",r.message)
                        localStorage.setItem("position",r.position)
                        alert("欢迎您用户"+r.message)
                        window.location.href="index.html"
                    }else
                    {
                        localStorage.removeItem("token")
                        localStorage.removeItem("account")
                        localStorage.removeItem("position")
                        alert(r.message)
                    }
                    }
                })
                //阻止表单提交
                return false
            })
        })
    </script>
</head>
<body style="background:transparent;">
<div class="modal-dialog" style="margin-top: 10%;">
    <div class="modal-content">
        <div class="modal-header">

            <h4 class="modal-title text-center" id="myModalLabel">登录</h4>
        </div>
        <form>
        <div class="modal-body" id = "model-body">
            <div class="form-group">
                <input type="text" id="userAccount" name="userAccount" class="form-control"placeholder="用户名" autocomplete="off">
            </div>
            <div class="form-group">
                <input type="password" id="userPassword" name="userPassword" class="form-control" placeholder="密码" autocomplete="off">
            </div>
        </div>
        <div class="modal-footer">
            <div class="form-group">
                <a href="insertUser.html" class="text-primary" target="main"><span class="glyphicon glyphicon-user"></span>注册</a>
                <button  type="submit" class="btn btn-primary form-control align-content-center">登录</button>
            </div>
        </div>
        </form>
    </div><!-- /.modal-content -->
</div><!-- /.modal -->

</body>
</html>